"""
应付款首页页面
"""

from page.base_page import BasePage
from selenium.webdriver.common.by import By

class YfkPage(BasePage):
    url = "http://192.168.1.25/crm/index.php?m=finance&a=index&t=payables"

    #定位器
    xj_yfk_locator = (By.CSS_SELECTOR, 'body > div.container > div.row > div:nth-child(1) > div.pull-right > a:nth-child(1)') #添加应付款
    xg_locator = (By.LINK_TEXT, '修改') #应付款修改
    table_locator = (By.CSS_SELECTOR,'#form1 > table > tbody')
    yfk_sousuo_locator = (By.ID, 'search')
    yfk_sousuo_btn_locator = (By.CSS_SELECTOR, '#searchForm > ul > li:nth-child(4) > button')
    #操作方法
    # 点击添加应付款
    def click_tj_yfk_btn(self):
        self.driver.find_element(*self.xj_yfk_locator).click()
    # 点击修改
    def click_xg_btn(self):
        self.driver.find_element(*self.xg_locator).click()
    #输入应付款名
    def input_yfk_sousuo(self,yfkm):
        self.driver.find_element(*self.yfk_sousuo_locator).send_keys(yfkm)
    def click_yfk_sousuo(self):
        self.driver.find_element(*self.yfk_sousuo_btn_locator).click()
    # # 获取表格
    # def get_table_element(self):
    #     return self.driver.find_element(*self.table_locator)